<?php
namespace Club\Model;
use Think\Model;
class UserClubModel extends Model {
    protected $_auto = [
        ["create_time", "strtotime", 3, "function"],
        ["update_time", "strtotime", 3, "function"],
        ["create_time", "time", 1, "function"],
        ["update_time", "time", 2, "function"],
    ];
    protected $_validate = [
        ["id", "require", "ID必须填写!"],
        ["principal_id", "require", "用户名必须填写!"],
        ["club_name", "require", "旅行社名称必须填写!"],
        ["address", "require", "旅行社地址必须填写!"],
        ["service_area", "require", "服务地区必须填写!"],
        ["bussiness", "require", "业务范围必须填写!"],
        ["tel", "require", "电话必须填写!"],
        ["justification", "require", "执照必须填写!"],
        ["create_time", "require", "注册时间必须填写!"],
        ["update_time", "require", "更新时间必须填写!"],
    ];
    public $excel = false;
    public $fieldMap = [
        "id"=>[
            "type"=>"input",
            "name"=>"ID",
            "lists"=>true,
            "search"=>true,
            "input"=>false,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "principal_id"=>[
            "type"=>"input",
            "name"=>"用户名",
            "lists"=>true,
            "search"=>false,
            "input"=>true,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "club_name"=>[
            "type"=>"input",
            "name"=>"旅行社名称",
            "lists"=>true,
            "search"=>false,
            "input"=>true,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "address"=>[
            "type"=>"input",
            "name"=>"旅行社地址",
            "lists"=>true,
            "search"=>false,
            "input"=>true,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "service_area"=>[
            "type"=>"input",
            "name"=>"服务地区",
            "lists"=>true,
            "search"=>false,
            "input"=>true,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "bussiness"=>[
            "type"=>"input",
            "name"=>"业务范围",
            "lists"=>true,
            "search"=>false,
            "input"=>true,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>'
                <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right" for="bussiness"> 业务范围 </label>
                <div class="col-xs-12 col-sm-6">
                    <span class="block input-icon input-icon-right" style="padding-top:0.2rem;">
                        <php>$fundingType = D("FundingType")->select();</php>
                        <volist name="fundingType" id="vo">
                            <label><input type="checkbox" value="{$vo[\'id\']}" name="bussiness[]" id="bussiness[]" <if condition="strstr($model[\'bussiness\'], $vo[\'id\'])" > checked</if> />{$vo[\'long_name\']} &nbsp;&nbsp;</label>
                        </volist>
                        <i class=""></i>
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline" style="margin-bottom: 5px;"></div>
             </div>
            ',
            "detail_specify"=>'<tr>
                    <php>
                        $bussinessArr = explode(",", $detail["bussiness"]);
                        $bussinessStr = "";
                        foreach ($bussinessArr as $v) {
                            $fundingType = D("FundingType")->find($v)["long_name"];
                            $bussinessStr .= $fundingType.",";
                        }
                        $bussinessStr = rtrim($bussinessStr, ",");
                    </php>
                    <td class="center" width="20%">业务范围</td>
                    <td class="center">{$bussinessStr}</td>
                </tr>',
        ],
        "tel"=>[
            "type"=>"input",
            "name"=>"电话",
            "lists"=>true,
            "search"=>false,
            "input"=>true,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "justification"=>[
            "type"=>"file",
            "name"=>"执照",
            "lists"=>true,
            "search"=>false,
            "input"=>true,
            "required"=>false,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "create_time"=>[
            "type"=>"datetime",
            "name"=>"注册时间",
            "lists"=>false,
            "search"=>false,
            "input"=>false,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "update_time"=>[
            "type"=>"datetime",
            "name"=>"更新时间",
            "lists"=>false,
            "search"=>false,
            "input"=>false,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
    ];
}